<?php
require_once("dao/DAOFactory.php");
require_once("bizlayer/IBiz.php");
require_once("model/Photo.php");

class PlayerMgmt implements IBiz{
	static $dao;
	
	public static function searchPlayer($firstname,$mi,$lastname,$emailaddress,$hometown,$currentcity,$verified,$locked,$admin){
		self::initializeDao();
		return self::$dao->searchPlayer($firstname,$mi,$lastname,$emailaddress,$hometown,$currentcity,$verified,$locked,$admin);
	}
	
	
	public static function updatePlayer($player){
		self::initializeDao();
		self::$dao->saveItem($player);
	}
	
	public static function getAppearance($playerId){
		self::initializeDao();
		return self::$dao->getAppearance($playerId);
	}
	
	public static function getStandingByYear($playerId){
		self::initializeDao();
		return self::$dao->getStandingByYear($playerId);
	}
	
	public static function initializeDao(){
		self::$dao = DAOFactory::getDAO("player");
	}
	
	public static function addPhoto($caption,$imageData,$imageDataM,$imageDataT,$imgType,$size,$name,$ext,$playerid,$isProfPic){
		
		$photo = new Photo();
		$photo->imageDataLarge = $imageData;
		$photo->imageDataMed = $imageDataM;
		$photo->imageDataThumb = $imageDataT;
		$photo->imageName = $name;
		$photo->imageSize = $size;
		$photo->imageType = $imgType;
		$photo->caption = $caption;
		$photo->ext = $ext;
		
		self::initializeDao();
		return self::$dao->addPhoto($photo,$playerid,$isProfPic);
	}
	
	public static function getProfilePic($playerId){
		self::initializeDao();
		return self::$dao->getProfilePic($playerId);
	}
	
	public static function setProfilePic($playerid,$photoid){
		self::initializeDao();
		self::$dao->setProfilePic($playerid,$photoid);
	}
	
	public static function getPhotosByPlayerId($playerId){
		self::initializeDao();
		return self::$dao->getPhotosByPlayerId($playerId);
	}
}

?>
